package cz.anime.ppro.model;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;


/**
 * The persistent class for the event database table.
 * 
 */
@Entity
public class Event implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	@GeneratedValue(strategy=GenerationType.AUTO)
	private int id;

	@Temporal(TemporalType.DATE)
	private Date date;

	private String description;

	@Temporal(TemporalType.DATE)
	@Column(name="event_date")
	private Date eventDate;

	private String text;

	//bi-directional many-to-one association to Attendant
	@OneToMany(mappedBy="event", orphanRemoval=true)
	private List<Attendant> attendants;

	//bi-directional many-to-one association to Webuser
	@ManyToOne
	@JoinColumn(name="creator")
	private Webuser webuser;

	//bi-directional many-to-many association to Webuser
	@ManyToMany(mappedBy="events2", fetch=FetchType.EAGER)
	private List<Webuser> webusers;

	public Event() {
	}

	public int getId() {
		return this.id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public Date getDate() {
		return this.date;
	}

	public void setDate(Date date) {
		this.date = date;
	}

	public String getDescription() {
		return this.description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public Date getEventDate() {
		return this.eventDate;
	}

	public void setEventDate(Date eventDate) {
		this.eventDate = eventDate;
	}

	public String getText() {
		return this.text;
	}

	public void setText(String text) {
		this.text = text;
	}

	public List<Attendant> getAttendants() {
		return this.attendants;
	}

	public void setAttendants(List<Attendant> attendants) {
		this.attendants = attendants;
	}

	public Webuser getWebuser() {
		return this.webuser;
	}

	public void setWebuser(Webuser webuser) {
		this.webuser = webuser;
	}

	public List<Webuser> getWebusers() {
		return this.webusers;
	}

	public void setWebusers(List<Webuser> webusers) {
		this.webusers = webusers;
	}

}